home *** CD-ROM | disk | FTP | other *** search
- @echo off
- ! renAlias.bat
- ! This batch file removes from all files in the current directory the ending " alias"
- !
- ! prepare a file with the list of all file names which end with " alias"
- dir/a-d/b "* alias" > renAlias_fileList
-
- ! open the list of names for reading
- open renAlias_fileList renAlias_fileID
-
- ! read one line (ie. one name) at a time until the end of file is reached
- onerror done
- repeat loop
-
- ! read one name into the variable oldName
- read %reAlias_fileID% renAlias_oldName
-
- ! remove the double quotes that DIR put at each end of the file name
- decr -renAlias_oldName
- decr renAlias_oldName
-
- ! make a copy of the name and remove from it the word " alias"
- set renAlias_newName=%renAlias_oldName%
- decr renAlias_newName by " alias"
-
- ! finally, do the actual renaming
- ren %renAlias_oldName% %renAlias_newName%
- :loop
-
- :done
-
- ! clean up before terminating
- close %renAlias_fileID%
- del renAlias_fileList
- set renAlias_fileID=
- set renAlias_oldName=
- set renAlias_newName=
-